Sorting

So... I got bored. I remembered having watched aTom Scott videoabout sorting algorithms and decided to have a go at it myself.

I decided to make the animation in Javascript P5, as I had just done a project with it and it would be easy to implement on this website.

Efficiency of sorting algorithms is indicated with a big O notation. The big O notation indicates how sorting algorithm efficiency increases.
Bubble sort, the algorithm used for this animation for example has a big O notation of O(n²). This means that in a worst case scenario the load steps increase exponentially. Bubble sort works by comparing the first and second tower and swapping if necessary then with the second and third etc until everything is sorted. This is by far isn't the fastest way of sorting and an easy upgrade would for example be to use insertion sorting, it would be much faster and not that hard to implement. For a better explanation you'll have to watchTom Scott's videothough.

For a full screen version of the animation,Click Here.